package com.gp.common.result;


/**
 * Author: D.Yang Email: koyangslash@gmail.com Date: 16/8/31 Time: 下午5:50 Describe: 封装Json返回信息
 */
public final class JsonResult {
  private boolean success;
  private String status;
  private String msg = "后端已进行处理";
  private Object obj;

  public JsonResult() {}

  public JsonResult(boolean success, String status, String msg) {
    this.success = success;
    this.status = status;
    this.msg = msg;
  }
  
  public JsonResult(String status, String msg) {
    this.status = status;
    this.msg = msg;
  }
  
  public JsonResult(int state, Object obj) {
    this.success = state==200;
    this.status = String.valueOf(state);
    this.obj = obj;
  }

  public JsonResult(String msg, Object obj) {
    this.obj = obj;
    this.status = "200";
    this.msg = msg;
    this.success = true;
  }

  public boolean isSuccess() {
    return success;
  }

  public void setSuccess(boolean success) {
    this.success = success;
  }

  public void getSuccess(boolean success) {
    this.success = success;
  }

  public String getStatus() {
    return status;
  }

  public void setStatus(String status) {
    this.status = status;
  }

  public String getMsg() {
    return msg;
  }

  public void setMsg(String msg) {
    this.msg = msg;
  }

  public Object getObj() {
    return obj;
  }

  public void setObj(Object obj) {
    this.obj = obj;
  }
}
